#ifndef __COMMON_H_
#define __COMMON_H_

#include <inttypes.h>

// point structure for history
typedef struct pt_s {
	double 			t;
	double			y;
} pt_t;

// in-memory buffer structure for history
typedef struct cirbuf_s {
	int 			npt;
	pt_t 			*pt;
	int				head;
	int				tail;		
} cirbuf_t;

// config structure for history
typedef struct cfg_s {
	char			*point_name;
	int				nodeid;
	int				addr;
	cirbuf_t 		*buf;
	int				buf_size;	
} cfg_t;

// buffer with interpolated data
typedef struct query_buf_s {
	pt_t			*values;
	int				nvalues;
	double			t_beg;
	double			t_end;
	char			*name;	
} query_buf_t;

// histories
typedef struct histories_s {
	cfg_t			*cfg;
	int				ncfg;
	int				buf_size;	
} histories_t;


#endif // __COMMON_H_